package com.gc.server.vo.up;


import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;



import com.gc.server.entity.BookEntity;
import com.gc.server.vo.BookVo;

                                            import com.gc.server.enums.BookStatusEnum;
    
/**
 * 绘本实体
 * 表名 book
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Tue Oct 27 10:38:33 CST 2020
 */
@Data
public class BookUp implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

                        //
            @ExcelProperty("")
            private Long id;
        
                        //作者
            @ExcelProperty("作者")
            private String author;
        
                        //文件名
            @ExcelProperty("文件名")
            private String fileName;
        
                        //标题
            @ExcelProperty("标题")
            private String title;
        
                        //简介
            @ExcelProperty("简介")
            private String content;
        
                        //投票数
            @ExcelProperty("投票数")
            private Integer ticket;
        
                        //IMG-封面
            @ExcelProperty("IMG-封面")
            private String img;
        
                        //分类
            @ExcelProperty("分类")
            private Integer type;
        
                        //上传时间
            @ExcelProperty("上传时间")
            private Date time;
        
                        //ENUM-状态:"DOWN-下架","UP-上架"
            @ExcelIgnore
            private Integer status;
                        @ExcelProperty("状态")
            private String statusStr;
        
    
    public BookUp() {

    }

    public BookVo toVo() {

        BookEntity entity = new BookEntity();
            BookVo vo = new BookVo(entity);
                                    entity.setId(id);
            
                                    entity.setAuthor(author);
            
                                    entity.setFileName(fileName);
            
                                    entity.setTitle(title);
            
                                    entity.setContent(content);
            
                                    entity.setTicket(ticket);
            
                                    entity.setImg(img);
            
                                    entity.setType(type);
            
                                    entity.setTime(time);
            
                                    if (getStatusStr() != null) {
                    entity.setStatus(BookStatusEnum.nameOf(getStatusStr()));
                }
            
        
        return  vo;
    }



}
